package com.whfc.ms.api.emp.service.impl;

import com.whfc.common.result.PageData;
import com.whfc.emp.dto.*;
import com.whfc.emp.enums.AttendType;
import com.whfc.emp.param.*;
import com.whfc.emp.service.AppEmpAttendService;
import com.whfc.emp.service.AppEmpConfigService;
import com.whfc.emp.service.AppEmpService;
import com.whfc.entity.dto.OssPathDTO;
import com.whfc.ms.api.emp.service.MsAppEmpAttendService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @ClasssName MsAppEmpAttendServiceImpl
 * @Description 人员考勤中心
 * @Author hw
 * @Date 2020/12/23 9:34
 * @Version 1.0
 */
@Service
public class MsAppEmpAttendServiceImpl implements MsAppEmpAttendService {


    @DubboReference(interfaceClass = AppEmpAttendService.class, version = "1.0.0")
    private AppEmpAttendService appEmpAttendService;

    @DubboReference(interfaceClass = AppEmpService.class, version = "1.0.0")
    private AppEmpService appEmpService;

    @DubboReference(interfaceClass = AppEmpConfigService.class, version = "1.0.0")
    private AppEmpConfigService appEmpConfigService;

    @Override
    public PageData<AttendDayEmpDTO> attendDayList(Integer pageNum, Integer pageSize, Date date, Integer deptId, Integer corpId, Integer groupId, String keyword, Integer attendState) {
        return appEmpAttendService.attendDayList(pageNum, pageSize, date, deptId, corpId, groupId, keyword, attendState);
    }

    @Override
    public PageData<AppEmpAttendMonthDTO> attendMonthList(Integer pageNum, Integer pageSize, Date time, Integer deptId, Integer corpId, Integer groupId, String keyword) {
        return appEmpAttendService.attendMonthList(pageNum, pageSize, time, deptId, corpId, groupId, keyword);
    }

    @Override
    public OssPathDTO exportMonthReport(EmpMonthReportExportParam request) throws Exception {
        return appEmpAttendService.exportMonthReport(request);
    }

    @Override
    public OssPathDTO exportDayReport(EmpDayReportExportParam request) throws Exception {
        return appEmpAttendService.exportDayReport(request);
    }

    @Override
    public PageData<EmpDataDTO> empDayList(Integer deptId, Date startDate, Date endDate, Integer pageNum, Integer pageSize) {
        return appEmpAttendService.empDayList(deptId, startDate, endDate, pageNum, pageSize);
    }

    @Override
    public void setEmpDataPlan(EmpAttendPlan plan) {
        appEmpAttendService.setDataPlan(plan);
    }

    @Override
    public List<AppEmpGpsDTO> attendGpsList(Integer empId, Date date) {
        return appEmpService.getGpsList(empId, date);
    }


    @Override
    public void setAttendType(AppEmpAttendTypeSetParam request) {
        Integer deptId = request.getDeptId();
        Integer type = request.getType();
        AttendType attendType = AttendType.parseByValue(type);
        appEmpConfigService.setAttendType(deptId, attendType);
    }

    @Override
    public AppEmpAttendTypeDTO getAttendType(Integer deptId) {
        AttendType attendType = appEmpConfigService.getAttendType(deptId);
        AppEmpAttendTypeDTO typeDTO = new AppEmpAttendTypeDTO();
        typeDTO.setType(Integer.valueOf(attendType.getValue()));
        return typeDTO;
    }

    @Override
    public PageData<AppEmpAttendRecordDTO> attendRecord(Integer empId, Date date, Integer pageNum, Integer pageSize, Integer state) {
        return appEmpAttendService.attendRecord(empId, date, pageNum, pageSize, state);
    }

    @Override
    public PageData<AppFaceGateRecordDTO> attendFaceGateList(Integer pageNum, Integer pageSize, Integer deptId, String keyword, Date startTime, Date endTime) {
        return appEmpAttendService.attendFaceGateList(pageNum, pageSize, deptId, keyword, startTime, endTime);
    }

    @Override
    public PageData<AppFaceGateRecordDTO> visitorList(Integer pageNum, Integer pageSize, Integer deptId, Date startTime, Date endTime) {
        return appEmpAttendService.visitorList(pageNum, pageSize, deptId, startTime, endTime);
    }

    @Override
    public OssPathDTO faceGateRecordExport(FaceGateRecordExportParam param) throws Exception {
        return appEmpAttendService.faceGateRecordExport(param);
    }

    @Override
    public AppEmpAttendDayNumDTO attendDayNum(Date date, Integer deptId, Integer corpId, Integer groupId, String keyword, Integer empId) {
        return appEmpAttendService.attendDayNum(date, deptId, corpId, groupId, keyword, empId);
    }

    @Override
    public OssPathDTO visitorListExport(Integer deptId, Date startTime, Date endTime) {
        return appEmpAttendService.visitorListExport(deptId,startTime,endTime);
    }

    @Override
    public List<AppFaceGateRecordDTO> discernList(Integer deptId, Date startTime, Date endTime,Integer type) {
        return appEmpAttendService.discernList(deptId, startTime, endTime,type);
    }

    @Override
    public List<AppFaceGateRecordDTO> temperatureAbnormalList(Integer deptId,Date startTime, Date endTime) {
        return appEmpAttendService.temperatureAbnormalList(deptId,startTime,endTime);
    }

    @Override
    public void syncRecord(AppEmpAttendSyncParam request) {
        appEmpAttendService.syncRecord(request);
    }
}
